<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<span></span>
</body>
<script>
  let hd = 'helloworld'
  for (let i = 0; i < hd.length; i++) {
    var span = document.createElement("span");
    span.style.fontSize = (i + 1) * 10 + 'px';
    span.innerHTML = hd[i];
    document.body.append(span)
  }

  //    字符串截取
  // 1. slice 2. substr 3. substring ,这三个方法主要在参数时负数的时候会有差别,选择合理的方法使用即可
  let str = 'hello,world'
  console.log(str.substr(1))
  console.log(str.slice(2))
  console.log(str.substring(1))

  //字符串查找
  let word = ['hello', 'world']
  let text = 'fklsadjfk hello,sdlkfjklsdf,world'
  let b = word.some(i => text.includes(i));
  if (b) {
    console.log('找到了关键词')
  }

  //字符串替换
  let th = "hello,js";
  let replace = th.replace("hello", "hey");
  console.log(replace)
</script>
</html>
